@textlint/linter-formatter
textlint output formatter.
Installation
npm install @textlint/linter-formatter
Usage
See formatters/.
Currently, you can use "stylish" (defaults), "checkstyle", "compact", "jslint-xml", "json", "junit", "pretty-error", "table", "tap", and "unix".
const createFormatter = require("@textlint/linter-formatter").createFormatter;
const formatter = createFormatter({
formatterName: "stylish"
});
const output = formatter([
{
filePath: "./README.md",
messages: [
{
ruleId: "semi",
line: 1,
column: 23,
message: "Expected a semicolon."
}
]
}
]);
console.log(output);
API
export declare type FormatterConfig = {
color?: boolean;
formatterName: string;
};
export declare function createFormatter(formatterConfig: FormatterConfig): (results: TextlintResult[]) => string;
export interface FormatterDetail {
name: string;
}
export declare function getFormatterList(): FormatterDetail[];
CLI
$ textlint -f json README.md --rule no-todo | textlint-formatter -f pretty-error --stdin
Other formatter
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
License
MIT